package com.example.tests;

import java.util.Set;

import org.testng.annotations.Test;

import com.example.fw.GroupObject;
import com.example.fw.Groups;

public class GroupModificationTest extends TestBase {
	
	@Test(dataProvider = "groupsFromFile", dataProviderClass = GroupDataGenerator.class)
	public void testValidGroupCanBeModificated(GroupObject validGroup) throws Exception {
		//Set<GroupObject> oldList = app.getGroupHelper().getGroups();
		Groups oldList = app.getGroupHelper().getGroups();
		// action
		app.getGroupHelper().modifyGroup(0, validGroup);
		// verification
		//Set<GroupObject> newList = app.getGroupHelper().getGroups();
		Groups newList = app.getGroupHelper().getGroups();
		//assertThat(newList, equalTo(oldList.withAdded(validGroup)));
		//verifyGroupModify(oldList, newList);
		assertThat(newList, equalTo(oldList.withRemoved(someGroup).withAdded(validGroup)))
		//assertThat(newList, equalTo(oldList.withRemoved(groupBeforeModification).withAdded(groupAfterModification)));



	}
	
}
